<script>
import index, { mapState } from 'vuex'

export default {
  name: 'ETab',
  data () {
    return {
      bowen1: []
    }
  },
  props: [
    'tabPosition',
    'shu1'
  ],
  computed: {
    index () {
      return index
    },
    ...mapState(['bowen']),
    filter (fl) {
      return this.bowen.filter(item => item.fenlai_display === fl).slice(0, 6)
    }
  },
  created () {
    // console.log(this.bowen)
  }
}
</script>

<template>
  <el-tabs :tab-position="tabPosition" class="tabs" type="card" >
    <el-tab-pane label="Django" style="height: 100%">
      <div v-for="item in bowen.filter(i=>i.fenlei_display === 'Django').slice(0,6)" :key="item.id">
        <main-card  :shu="item"></main-card>
      </div>
    </el-tab-pane>
    <el-tab-pane label="Vue">
      <div v-for="item in bowen.filter(i=>i.fenlei_display === 'Vue').slice(0,6)" :key="item.id">
        <main-card  :shu="item"></main-card>
      </div>
    </el-tab-pane>
    <el-tab-pane label="Ajax">
      <div v-for="item in bowen.filter(i=>i.fenlei_display === 'Ajax').slice(0,6)" :key="item.id">
        <main-card  :shu="item"></main-card>
      </div>
    </el-tab-pane>
    <el-tab-pane label="随记">
      <div v-for="item in bowen.filter(i=>i.fenlei_display === '随记').slice(0,6)" :key="item.id">
        <main-card  :shu="item"></main-card>
      </div>
    </el-tab-pane>
  </el-tabs>
</template>

<style scoped lang="scss">
$bgd:rgba(0,0,0, 0.5);
$textcol:white;
.tabs {
  transition: all .5s;
  max-width: 1400px;
  margin-bottom: 20px;
  font-weight: bold;
}

::v-deep .el-tabs__header {
  user-select: none;
  border-radius: 30px;
  border: 2px solid #003153;
  padding: 2px;
  background: $bgd;

  .el-tabs__nav-scroll {
    display: flex;
    justify-content: center;
    border-radius: 30px;
    .el-tabs__nav {
      border: 0;
      border-radius: 10px;
    }
  }
}
::v-deep .el-tabs__item {
  border: transparent!important;
  font-size: 14px;
  text-align: center;
  transition: all 0.5s;
  margin: 4px;
  border-radius: 30px;
  color: grey;

  &:hover {
    background: #003153;
  }
;

  &.is-active {
    background: #003153;
    color: $textcol;
  }
}

</style>
